package pl.enigmatic.jpf;

import java.util.HashMap;
import java.util.Map;

import pl.enigmatic.math.graph.Tree;


public class DependencyObject<T> extends Tree<T, DependencyObject<T>> {

	private final Map<DependencyProperty<? extends DependencyObject<T>, ?>, Object> properties = new HashMap<DependencyProperty<? extends DependencyObject<T>, ?>, Object>();

	public DependencyObject(final T base) {
		super(base);
	}

	public DependencyObject() {
		this(null);
	}

	@SuppressWarnings("unchecked")
	public <X> X getValue(final DependencyProperty<? extends DependencyObject<T>, X> property) {
		return (X) properties.get(property);
	}

	public <X> X put(final DependencyProperty<? extends DependencyObject<T>, ?> property, final X value) {
		properties.put(property, value);
		return value;
	}

}
